function filtereddata=uwbdatafilter(origindata)
    % filter the uwbdata 
    % ATTENTION: the filter will ignore the correspondence of among data row
    if isempty(origindata)
        filtereddata = [];
        return
    end
    origindata(origindata==0)=nan;
    filtereddata=nan(size(origindata));
    for i = 1: size(origindata,2)
        uwbdata  = origindata(:,i);
        uwbdata  = uwbdata(~isnan(uwbdata));
        while(true)
            uwbdatamean = mean(uwbdata,1);
            tmpdata = uwbdata-repmat(uwbdatamean,size(uwbdata,1),1);
            distance=sqrt( sum(tmpdata.^2,2));
            [val,ind]= max(distance);
            if(val>600)
                index = 1:size(uwbdata,1);
                index = index(index~=ind);
                uwbdata =uwbdata(index,:);
            else
                break;
            end
        end
        filtereddata(1:length(uwbdata),i)=uwbdata;
    end